<?php
use yii\helpers\Url;

$web = Url::base();

$site_name = \app\models\Mall::getCurrentInstitutionSiteName();
$this->title = $site_name . '-休闲小游戏';
?>

<link rel="stylesheet" type="text/css" href="<?= $web ?>/css/mall-m/game-list.css"/>

<div class="main">
    <div class="game-list">
        <ul>
            <li data-href="http://game.dorabox.com.cn/wjsw/index.html">
                <img class="game-list-img" src="http://game.dorabox.com.cn/wjsw/icon.png"/>
                <p class="title">我就是我</p>
                <p class="people-num">有<span>2000+</span>人玩过</p>
                <div class="start-game">
                    <img src="<?= $web ?>/images/mall-m/star-game-icon.png"/>
                    <div class="star-btn">开始游戏</div>
                </div>
            </li>

            <li data-href="http://game.dorabox.com.cn/mlss/index.html">
                <img class="game-list-img" src="http://game.dorabox.com.cn/mlss/icon.png"/>
                <p class="title">小心女司机</p>
                <p class="people-num">有<span>1000+</span>人玩过</p>
                <div class="start-game">
                    <img src="<?= $web ?>/images/mall-m/star-game-icon.png"/>
                    <div class="star-btn">开始游戏</div>
                </div>
            </li>

            <li data-href="http://game.dorabox.com.cn/ninjas/index.html">
                <img class="game-list-img" src="http://game.dorabox.com.cn/ninjas/icon.png"/>
                <p class="title">忍者突袭</p>
                <p class="people-num">有<span>4000+</span>人玩过</p>
                <div class="start-game">
                    <img src="<?= $web ?>/images/mall-m/star-game-icon.png"/>
                    <div class="star-btn">开始游戏</div>
                </div>
            </li>

            <li data-href="http://game.dorabox.com.cn/rhino/index.html">
                <img class="game-list-img" src="http://game.dorabox.com.cn/rhino/icon.png"/>
                <p class="title">犀牛溜冰场</p>
                <p class="people-num">有<span>2000+</span>人玩过</p>
                <div class="start-game">
                    <img src="<?= $web ?>/images/mall-m/star-game-icon.png"/>
                    <div class="star-btn">开始游戏</div>
                </div>
            </li>
        </ul>
    </div>
</div>

<script type="application/javascript">
    $(function () {
        $('li').click(function () {
            var r = confirm('消费 1 积分玩此游戏?');
            if (r == true) {
                var that = this;
                var responseData = requestJsonMallM('play-game-pay-integral-handler', null);
//                var responseData = {};
//                responseData.status = 0;
                if (responseData.status == 0) {
                    window.location.href = $(that).data('href');
                } else if (responseData.status == 10) {
                    alert('积分不足!');
                } else {
                    alert('扣除积分失败!');
                }
            }
        });
    });
</script>

